/// <reference path="sage.util.js" />

var BaseInputHandler = Base.extend({
    initialize: function initialize(eventNames) {
        this.enabled = false;
        this.subscribers = {};
        if (eventNames != null)
            this.eventNames = eventNames;
        else
            this.eventNames = [];
    },
    isAvailable: function isAvailable() {
        return true;
    },
    subscribe: function subscribe(name, handler) {
        this.subscribers[name] = handler;
    },
    unsubscribe: function subscribe(name) {
        this.subscribers[name] = null;
    },
    setup: function setup() {
    },
    teardown: function teardown() {
        if (this.enabled) {
            this.enabled = false;
            for (var i = 0; i < this.eventNames.length; i++) {
                $(window).off(this.eventNames[i]);
            }
        }
    }
});
